light6 2.2.0
Loading...
Searching...
No Matches
Light 6 Click Driver

API for configuring and manipulating Light 6 Click driver. More...

Topics

 Light 6 Registers List
 List of registers of Light 6 Click driver.
 Light 6 Registers Settings
 Settings for registers of Light 6 Click driver.
 Light 6 MikroBUS Map
 MikroBUS pin mapping of Light 6 Click driver.

Functions

void light6_cfg_setup (light6_cfg_t *cfg)
 Light 6 configuration object setup function.
err_t light6_init (light6_t *ctx, light6_cfg_t *cfg)
 Light 6 initialization function.
err_t light6_default_cfg (light6_t *ctx)
 Light 6 default configuration function.
err_t light6_generic_write (light6_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Light 6 I2C writing function.
err_t light6_generic_read (light6_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Light 6 I2C reading function.
uint8_t light6_get_int_pin (light6_t *ctx)
 Light 6 get INT pin function.
err_t light6_check_communication (light6_t *ctx)
 Light 6 Check Communication function.
err_t light6_set_als_config (light6_t *ctx, uint16_t config)
 Light 6 Set ALS Configuration function.
err_t light6_get_als_config (light6_t *ctx, uint16_t *config)
 Light 6 Get ALS Configuration function.
err_t light6_set_als_threshold (light6_t *ctx, uint16_t threshold_low, uint16_t threshold_high)
 Light 6 Set ALS Threshold function.
err_t light6_get_als_threshold (light6_t *ctx, uint16_t *threshold_low, uint16_t *threshold_high)
 Light 6 Get ALS Threshold function.
err_t light6_get_int_flag (light6_t *ctx, uint8_t *int_flag)
 Light 6 Get Interrupt Flag function.
err_t light6_get_raw_data (light6_t *ctx, uint16_t *als_data, uint16_t *ir_data)
 Light 6 Get Raw Data function.
err_t light6_get_data (light6_t *ctx, float *als_data, uint16_t *ir_data)
 Light 6 Get Processed Data function.

Detailed Description

API for configuring and manipulating Light 6 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ light6_cfg_setup()

void light6_cfg_setup ( light6_cfg_t * cfg)

Light 6 configuration object setup function.

This function initializes Click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See light6_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ light6_check_communication()

err_t light6_check_communication ( light6_t * ctx)

Light 6 Check Communication function.

This function checks the device ID to verify communication with the Light 6 sensor.

Parameters
[in]ctx: Click context object. See light6_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ light6_default_cfg()

err_t light6_default_cfg ( light6_t * ctx)

Light 6 default configuration function.

This function executes a default configuration of Light 6 Click board.

Parameters
[in]ctx: Click context object. See light6_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ light6_generic_read()

err_t light6_generic_read ( light6_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Light 6 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See light6_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ light6_generic_write()

err_t light6_generic_write ( light6_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Light 6 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See light6_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ light6_get_als_config()

err_t light6_get_als_config ( light6_t * ctx,
uint16_t * config )

Light 6 Get ALS Configuration function.

This function reads the ALS configuration register.

Parameters
[in]ctx: Click context object. See light6_t object definition for detailed explanation.
[out]config: Pointer to store the 16-bit configuration data.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ light6_get_als_threshold()

err_t light6_get_als_threshold ( light6_t * ctx,
uint16_t * threshold_low,
uint16_t * threshold_high )

Light 6 Get ALS Threshold function.

This function reads the ALS threshold values.

Parameters
[in]ctx: Click context object. See light6_t object definition for detailed explanation.
[out]threshold_low: Pointer to store the lower threshold value.
[out]threshold_high: Pointer to store the upper threshold value.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ light6_get_data()

err_t light6_get_data ( light6_t * ctx,
float * als_data,
uint16_t * ir_data )

Light 6 Get Processed Data function.

This function reads the raw IR data and ambient light intensity in lux based on raw ALS data.

Parameters
[in]ctx: Click context object. See light6_t object definition for detailed explanation.
[out]als_data: Pointer to store calculated ambient light intensity (in lux).
[out]ir_data: Pointer to store raw infrared sensor data.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ light6_get_int_flag()

err_t light6_get_int_flag ( light6_t * ctx,
uint8_t * int_flag )

Light 6 Get Interrupt Flag function.

This function reads the interrupt flag status.

Parameters
[in]ctx: Click context object. See light6_t object definition for detailed explanation.
[out]int_flag: Pointer to store the interrupt flag status.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ light6_get_int_pin()

uint8_t light6_get_int_pin ( light6_t * ctx)

Light 6 get INT pin function.

This function returns the INT pin logic state.

Parameters
[in]ctx: Click context object. See light6_t object definition for detailed explanation.
Returns
INT pin logic state.
Note
None.

◆ light6_get_raw_data()

err_t light6_get_raw_data ( light6_t * ctx,
uint16_t * als_data,
uint16_t * ir_data )

Light 6 Get Raw Data function.

This function reads the raw ALS and IR sensor data.

Parameters
[in]ctx: Click context object. See light6_t object definition for detailed explanation.
[out]als_data: Pointer to store raw ambient light sensor data.
[out]ir_data: Pointer to store raw infrared sensor data.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ light6_init()

err_t light6_init ( light6_t * ctx,
light6_cfg_t * cfg )

Light 6 initialization function.

This function initializes all necessary pins and peripherals used for this Click board.

Parameters
[out]ctx: Click context object. See light6_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See light6_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ light6_set_als_config()

err_t light6_set_als_config ( light6_t * ctx,
uint16_t config )

Light 6 Set ALS Configuration function.

This function sets the ALS (ambient light sensor) configuration register.

Parameters
[in]ctx: Click context object. See light6_t object definition for detailed explanation.
[in]config: 16-bit configuration data.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ light6_set_als_threshold()

err_t light6_set_als_threshold ( light6_t * ctx,
uint16_t threshold_low,
uint16_t threshold_high )

Light 6 Set ALS Threshold function.

This function sets the ALS threshold values for interrupt generation.

Parameters
[in]ctx: Click context object. See light6_t object definition for detailed explanation.
[in]threshold_low: Lower threshold value.
[in]threshold_high: Upper threshold value.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.